package b1.mobile.blackberry.io.http;

public class SoapContentProvider{
	
	StringBuffer buffer = new StringBuffer();
	String _operator = null;
	public SoapContentProvider(String cmd, String[] paramNames, String[] paramValues){		
		_operator = cmd;
		
		buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
		buffer.append("<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body>");
		buffer.append("<" + cmd + " xmlns=\"http://tempuri.org/\">");
		
		for(int i = 0; i < paramNames.length; i++){
			String name = paramNames[i];
			String value = paramValues[i];
			
			buffer.append("<" + name + ">" + value + "</" + name + ">");
		}
		
		buffer.append("</" + cmd + ">");
		buffer.append("</SOAP-ENV:Body></SOAP-ENV:Envelope>");	
	}
	
	public String getSoapMessage(){
		return buffer.toString();
	}

	public String getOperator() {
		// TODO Auto-generated method stub
		return _operator;
	}
}
